]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
network: Add an empty state to the wifi dialog and adjust the sizing
authorJasper St. Pierre <jstpierre@mecheye.net>
Mon, 12 Aug 2013 17:19:32 +0000 (13:19 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Thu, 15 Aug 2013 00:39:07 +0000 (20:39 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=705916

data/theme/gnome-shell.css
js/ui/status/network.js

index 9e1187010606eec65e3c6b84e7a2533361cb4e60..e81e882bd6c9031b72c5b54161f8a5a19ccafd45 100644 (file)
@@ -272,7 +272,9 @@ StScrollBar StButton#vhandle:active {
 /* Network */
 
 .nm-dialog {
-    max-height: 400px;
+    max-height: 500px;
+    min-height: 450px;
+    min-width: 470px;
 }
 
 .nm-dialog-content {
@@ -1369,9 +1371,8 @@ StScrollBar StButton#vhandle:active {
     height: 72px;
 }
 
-.no-messages-label {
-    font-family: cantarell, sans-serif;
-    font-size: 11pt;
+.no-messages-label,
+.no-networks-label {
     color: #999999;
 }
 
index 3ced9ca4e8c33e1b4d9aabe8a8e410a621af0547..2b5efebd6d89e1e6f0de1ac2c67b10181f950630 100644 (file)
@@ -604,6 +604,10 @@ const NMWirelessDialog = new Lang.Class({
         this._connectButton.can_focus = connectSensitive;
     },
 
+    _updateVisibility: function() {
+        this._noNetworksLabel.visible = (this._networks.length == 0);
+    },
+
     _buildLayout: function() {
         let headline = new St.BoxLayout({ style_class: 'nm-dialog-header-hbox' });
 
@@ -624,12 +628,24 @@ const NMWirelessDialog = new Lang.Class({
         this.contentLayout.style_class = 'nm-dialog-content';
         this.contentLayout.add(headline);
 
+        this._stack = new St.Widget({ layout_manager: new Clutter.BinLayout() });
+
         this._itemBox = new St.BoxLayout({ vertical: true });
         this._scrollView = new St.ScrollView({ style_class: 'nm-dialog-scroll-view' });
+        this._scrollView.set_x_expand(true);
+        this._scrollView.set_y_expand(true);
         this._scrollView.set_policy(Gtk.PolicyType.NEVER,
                                     Gtk.PolicyType.AUTOMATIC);
         this._scrollView.add_actor(this._itemBox);
-        this.contentLayout.add(this._scrollView);
+        this._stack.add_child(this._scrollView);
+
+        this._noNetworksLabel = new St.Label({ style_class: 'no-networks-label',
+                                               x_align: Clutter.ActorAlign.CENTER,
+                                               y_align: Clutter.ActorAlign.CENTER,
+                                               text: _("No Networks") });
+        this._stack.add_child(this._noNetworksLabel);
+
+        this.contentLayout.add(this._stack, { expand: true });
 
         this._disconnectButton = this.addButton({ action: Lang.bind(this, this.close),
                                                   label: _("Cancel"),
@@ -824,6 +840,8 @@ const NMWirelessDialog = new Lang.Class({
             this._createNetworkItem(network);
             this._itemBox.insert_child_at_index(network.item.actor, newPos);
         }
+
+        this._updateVisibility();
     },
 
     _accessPointRemoved: function(device, accessPoint) {
@@ -844,6 +862,8 @@ const NMWirelessDialog = new Lang.Class({
             network.item.updateBestAP(network.accessPoints[0]);
             this._resortItems();
         }
+
+        this._updateVisibility();
     },
 
     _resortItems: function() {